#!/usr/bin/env python
# -*- coding:utf-8 -*-

import re

print('匹配至少一个数字' + ' -----------------------------------------------------------------------------------------------------------------------')
# 从任何位置开始往后查找，返回第一个符合规则的字符串，只匹配一次
pattern = re.compile(r'\d+')
m = pattern.search('aaaaa12345bbbbb12345')
n = pattern.search('aaaaa12345bbbbb12345', 2, 7)
print(m.group())  # 12345
print(n.group())  # 12
print(m.span())  # (5, 10)